/* ======= 基础组件样式 ======= */

/* 应用容器 */
/* 玻璃效果 */
.glass-effect {
  backdrop-filter: blur(10px);
  border: none;
  box-shadow: none;
  border-radius: 0;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
}

.glass-effect:hover {
  box-shadow: none;
}

/* 统一卡片样式 */
.glass-card {
  backdrop-filter: blur(10px);
  border: 1px solid var(--app-border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border-radius: var(--app-radius-sm);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
}

.glass-card::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: calc(var(--app-radius-sm) + 2px);
  background: transparent;
  border: 2px solid transparent;
  pointer-events: none;
  transition: all 0.25s ease-in-out;
  z-index: -1;
}

.glass-card:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.glass-card:hover::after {
  border-color: rgba(var(--el-color-primary-rgb), 0.3);
  box-shadow: 0 0 10px 2px rgba(var(--el-color-primary-rgb), 0.2);
}

/* 暗色模式下卡片样式 */
.dark-mode .glass-card {
  background: rgba(35, 35, 35, 0.8);
  border-color: rgba(80, 80, 80, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.dark-mode .glass-card:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* 顶部通栏 */
.app-header {
  padding: var(--app-spacing-md) var(--app-spacing-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: var(--app-spacing-md);
  z-index: 100;
  height: 60px;
  border-radius: var(--app-radius-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--app-border-color);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.app-header:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.dark-mode .app-header {
  background: rgba(35, 35, 35, 0.8);
  border-color: rgba(80, 80, 80, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.dark-mode .app-header:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.header-title {
  font-size: var(--app-font-size-xxl);
  font-weight: 600;
  margin: 0 0 0 var(--app-spacing-md);
  background: var(--app-gradient-title);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: var(--app-letter-spacing-tight);
}

/* 左侧面板 */
.left-panel {
  width: 260px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  padding: var(--app-spacing-base);
  box-shadow: var(--app-shadow-hover);
}

.panel-header h2 {
  margin: 0 0 0 var(--app-spacing-md);
  font-size: var(--app-font-size-md);
  font-weight: 600;
  flex: 1;
  color: var(--app-text-primary);
  letter-spacing: var(--app-letter-spacing-tight);
}

/* 消息样式 */
.message-bubble {
  padding: var(--app-spacing-md) var(--app-spacing-base);
  border-radius: var(--app-radius-md);
  background-color: var(--app-fill-light);
  border: 1px solid var(--app-border-color);
  box-shadow: var(--app-shadow-light);
  position: relative;
  transition: var(--app-transition-fast);
  margin-bottom: var(--app-spacing-base);
}

.message-bubble.system {
  background: var(--app-fill-regular);
}

.message-bubble:hover {
  box-shadow: var(--app-shadow-regular);
  transform: translateY(-1px);
}

.message-text {
  font-size: 15px;
  line-height: 1.6;
  word-break: break-word;
  margin-bottom: 4px;
}

/* ======= 分析按钮样式 ======= */
.analysis-btn {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  transition: var(--app-transition-normal);
  background: var(--app-gradient-button);
  border: none;
  box-shadow: 0 4px 15px rgba(var(--el-color-primary-rgb), 0.2);
  position: relative;
  overflow: hidden;
}

.analysis-btn::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(45deg);
  animation: buttonShine 6s infinite linear;
  z-index: 1;
}

.analysis-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(var(--el-color-primary-rgb), 0.3);
}

/* ======= 分析方向卡片样式 ======= */
.direction-card {
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-border: rgba(var(--el-color-primary-rgb), 0.1);
  --card-hover-bg: linear-gradient(
    120deg,
    rgba(var(--el-color-primary-rgb), 0.05),
    rgba(var(--el-color-primary-rgb), 0.15)
  );
  --card-hover-border: rgba(var(--el-color-primary-rgb), 0.2);
  --title-color: var(--app-text-primary);
  --title-hover-color: var(--el-color-primary-dark-2);
  --desc-bg: rgba(255, 255, 255, 0.95);
  --desc-color: var(--app-text-primary);
  --desc-after-color: rgba(255, 255, 255, 0.85);

  flex: 0 0 auto;
  min-width: 140px;
  max-width: 180px;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--app-transition-normal);
  background: var(--card-bg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--card-border);
  position: relative;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

.direction-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  border-color: var(--card-hover-border);
  background: var(--card-hover-bg);
}

.direction-card:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(var(--el-color-primary-rgb), 0.1);
}

.direction-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--title-color);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: var(--app-transition-fast);
}

.direction-card:hover .direction-title {
  color: var(--title-hover-color);
}

.direction-desc {
  position: absolute;
  left: 50%;
  bottom: 130%;
  /* 增加底部距离，防止遮挡 */
  transform: translateX(-50%) translateY(10px);
  margin-bottom: 5px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--desc-color);
  background: var(--desc-bg);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  border: 1px solid var(--card-border);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transition: var(--app-transition-normal);
  z-index: 10;
  max-width: 240px;
  min-width: 160px;
  word-wrap: break-word;
  pointer-events: none;
  /* 防止鼠标事件穿透 */
  text-align: center;
}

.direction-desc::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: var(--desc-after-color) transparent transparent transparent;
}

.direction-card:hover .direction-desc {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ======= 其他组件样式 ======= */

/* Loading dots animation */
.loading-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--el-color-primary);
  font-weight: 500;
}

.loading-dots span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
  opacity: 0.7;
  animation: loading-dots 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0s;
}

/* 消息列表滚动条样式 */
.messages-list::-webkit-scrollbar {
  width: 5px;
}

.messages-list::-webkit-scrollbar-thumb {
  background-color: rgba(64, 158, 255, 0.2);
  border-radius: 3px;
  transition: background-color 0.3s ease;
}

.messages-list::-webkit-scrollbar-thumb:hover {
  background-color: rgba(64, 158, 255, 0.4);
}

/* 上传组件样式 */
:deep(.el-upload-dragger) {
  background: var(--app-fill-light);
  border: 2px dashed var(--app-border-color);
  transition: var(--app-transition-normal);
  border-radius: var(--app-radius-md);
}

:deep(.el-upload-dragger:hover) {
  background: var(--app-fill-regular);
  border-color: var(--el-color-primary);
  transform: translateY(-2px);
  box-shadow: var(--app-shadow-light);
}

:deep(.el-upload-dragger .el-icon) {
  color: #409eff;
  font-size: 48px;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 5px rgba(64, 158, 255, 0.3));
}

:deep(.el-upload-dragger .el-upload__text) {
  color: inherit;
  font-size: 16px;
}

:deep(.el-upload-dragger .el-upload__text em) {
  color: #409eff;
  font-style: normal;
  font-weight: 500;
}

/* 其他元素样式 */
.el-icon {
  margin-right: 0px !important;
}

/* 动画 */
@keyframes buttonShine {
  0% {
    left: -100%;
  }

  100% {
    left: 100%;
  }
}

@keyframes loading-dots {
  0%,
  80%,
  100% {
    transform: scale(0);
    opacity: 0.5;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes backgroundScroll {
  0% {
    background-position: 0 0;
  }

  100% {
    background-position: 60px 60px;
  }
}

@keyframes pulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.5;
  }

  50% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0.8;
  }

  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.5;
  }
}

/* ========== 2. 基础布局和容器 ========== */

/* 应用容器 */
.el-icon {
  margin-right: 0px !important;
}

/* 主布局 */
.layout-container {
  display: flex;
  height: calc(100vh - 0px);
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 0;
}

.dark-mode .glass-effect {
  border: none;
  box-shadow: none;
}

.dark-mode .glass-effect:hover {
  box-shadow: none;
}

/* ======= 页面过渡动画 ======= */
.page-transition-enter-active,
.page-transition-leave-active {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-transition-enter-from {
  opacity: 0;
  transform: translateY(20px);
}

.page-transition-leave-to {
  opacity: 0;
  transform: translateY(-20px);
}

/* 卡片进入退出动画 */
.card-fade-enter-active,
.card-fade-leave-active {
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-fade-enter-from,
.card-fade-leave-to {
  opacity: 0;
  transform: scale(0.95);
}

/* 页面加载动画 */
.loading-skeleton {
  position: relative;
  overflow: hidden;
  background-color: rgba(var(--el-border-color-lighter), 0.4);
  border-radius: var(--app-radius-sm);
}

.loading-skeleton::after {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  transform: translateX(-100%);
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0,
    rgba(255, 255, 255, 0.2) 20%,
    rgba(255, 255, 255, 0.5) 60%,
    rgba(255, 255, 255, 0)
  );
  animation: shimmer 2s infinite;
  content: '';
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

.dark-mode .loading-skeleton {
  background-color: rgba(80, 80, 80, 0.3);
}

.dark-mode .loading-skeleton::after {
  background-image: linear-gradient(
    90deg,
    rgba(25, 25, 25, 0) 0,
    rgba(35, 35, 35, 0.2) 20%,
    rgba(35, 35, 35, 0.5) 60%,
    rgba(25, 25, 25, 0)
  );
}
